package net.zjitc.anntotation;


import java.lang.reflect.Method;

/**
 * Created by hasee on 2017/11/6.
 */
public class Test {
    public static void main(String[] args) throws ClassNotFoundException {
        //通过类名拿到类对象
        Class clazz = Class.forName("net.zjitc.anntotation.MyAnntotion");
        //遍历类的所有方法
        Method[] methods = clazz.getMethods();
        for (Method m:methods) {
            //如果方法有AntotationMapping的注释
            AntotationMapping antotationMapping = m.getAnnotation(AntotationMapping.class);
            if(antotationMapping!=null){
                //可以获得注释的对象,通过对象直接拿到值
                System.out.println(antotationMapping.age());
            }
        }
    }
}
